﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;

namespace CMS.Converts
{
    public class BoolToStringConvert : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            //从数据库转过来的值
            if(value==null) return "未知";
            if(bool.TryParse( value.ToString(),out bool result))
            {
                //真的话入库假的话出库
                return result?"入库":"出库";
            }
            return "未知";
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            //转数据库的
            throw new NotImplementedException();
        }
    }
}
